home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
wtjmarch.zip
/
DEBUGWIN.ZIP
/
DWTFDD.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1992-01-08
|
1KB
|
60 lines
LISTING 4: DWTFDD.PAS
This unit uses Turbo Pascal's text file device driver feature to make debugging more elegant. You C guys are on your own.
{$S-,R-}
unit dwTFDD;
interface
uses
dwCall, WinDos;
procedure AssignDW(var F : Text);
implementation
function dwOutput(var F : TTextRec) : Integer; far;
{-Text file device driver output function}
begin
if F.BufPos <> 0 then begin
dwWriteBuf(PChar(F.BufPtr), F.BufPos);
F.BufPos := 0;
end;
dwOutput := 0;
end;
function dwClose(var F : TTextRec) : Integer; far;
{-Text file device driver close function}
begin
dwClose := 0;
end;
function dwOpen(var F : TTextRec) : Integer; far;
{-Text file device driver open function}
begin
F.Mode := fmOutput;
F.InOutFunc := @dwOutput;
F.FlushFunc := @dwOutput;
F.CloseFunc := @dwClose;
dwOpen := 0;
end;
procedure AssignDW(var F : Text);
begin
with TTextRec(F) do begin
Handle := $FFFF;
Mode := fmClosed;
BufSize := SizeOf(Buffer);
BufPtr := @Buffer;
OpenFunc := @dwOpen;
Name[0] := #0;
end;
end;
begin
{set up Output to write to DebugWin's window}
AssignDW(Output);
Rewrite(Output);
end.